package com.atguigu.tingshu.common.service;

import com.atguigu.tingshu.common.constant.KafkaConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

@Service
public class KafkaService {

    private static final Logger logger = LoggerFactory.getLogger(KafkaService.class);

    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;

    public void sendMsg(String data){
        kafkaTemplate.send(KafkaConstant.QUEUE_USER_REGISTER,data);
    }
    public void sendMsg(String topic,String data){
        kafkaTemplate.send(topic,data);
    }

}
